<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AlgorithmsController extends Controller
{
    private $total = 0;
    public function permutation($num)
    {
        $this->total += $num;
        if ($num > 1){
            $this->permutation($num-1);
        }
    }

    public function test($n){

        if ($n > 1) {
            sum($n-1);
        }
        return $n;
    }

    public function sum()
    {
        $this->permutation(3);
        return $this->total;
    }
}
